package addrHelper

import (
	"awesomeTask/system/safe"
	"flag"
	"strconv"
)

var addrMap map[string]*string = make(map[string]*string)

func BuildAddr(IpAddress string, Port float64) *string {
	safe.Lock()
	key := IpAddress + ":" + strconv.Itoa(int(Port))
	connInfo := IpAddress + ":" + strconv.Itoa(int(Port))
	if value, ok := addrMap[key]; !ok {
		value = flag.String("addr", connInfo, "http service address")
		addrMap[key] = value
	}
	safe.Unlock()
	return addrMap[key]
}
